package org.example.projecttwo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.FieldFill;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 广告表
 * </p>
 *
 * @author nn
 * @since 2025-11-01
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("advertisement")
@Schema(name="广告表")
public class Advertisement implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "主键ID（雪花算法）")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @Schema(description = "广告编号")
    @TableField("ad_no")
    @NotBlank(message = "广告编号不能为空")
    @Size(max = 20, message = "广告编号长度不能超过20个字符")
    private String adNo;

    @Schema(description = "广告标题")
    @TableField("title")
    @NotBlank(message = "广告标题不能为空")
    @Size(max = 100, message = "广告标题长度不能超过100个字符")
    private String title;

    @Schema(description = "广告图片")
    @TableField("image_url")
    @NotBlank(message = "广告图片不能为空")
    @Size(max = 255, message = "广告图片URL长度不能超过255个字符")
    private String imageUrl;

    @Schema(description = "跳转链接")
    @TableField("link_url")
    @Size(max = 255, message = "跳转链接长度不能超过255个字符")
    private String linkUrl;

    @Schema(description = "广告描述")
    @TableField("description")
    @Size(max = 500, message = "广告描述长度不能超过500个字符")
    private String description;

    @Schema(description = "排序序号")
    @TableField(value = "sort_order", fill = FieldFill.INSERT)
    private Integer sortOrder = 0;

    @Schema(description = "状态")
    @TableField("status")
    private Integer status;

    @Schema(description = "点击次数")
    @TableField("click_count")
    private Integer clickCount;

    @Schema(description = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
    
}